const common = require('./webpack.common')
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

const DEV = {
  ...common,
  mode: 'production',
  plugins: [
    new CleanWebpackPlugin(),
    // 引入vue配套插件
    new VueLoaderPlugin(),
    new HtmlWebpackPlugin({
      // 输出文件名称
      filename: 'index.html',
      // 模板入口
      template: './template.html',
      // 模板参数
      templateParameters: {
        title: 'vue-task'
      }
    }),
    new CopyWebpackPlugin({
      patterns: [{
        from: path.join(__dirname, 'public'),
        to: path.join(__dirname, 'dist')
      }]
    })
  ]
}

module.exports = DEV